import java.util.Arrays;

public class MyStack {
    int[] array;
    int size;

    public MyStack(){
        array=new int[10];
    }
    public void push(int x){
        array[size++]=x;
    }
    public int pop(){
        return array[--size];
    }
    public int size(){
        return size;
    }
    public int peek(){
        if(isEmpty()){
            return -1;
        }
        return array[size-1];
    }
    public boolean isEmpty(){
        return size==0;
    }
    private void ensureCapacity(){
        if(size==array.length){
            array= Arrays.copyOf(array,size*2);
        }
    }

}
